//Made with Pyromaniac1444's Swep Generator
SWEP.base = "weapon_base"
SWEP.Category = "Your SWEPS";
SWEP.Author = "Ty";
SWEP.Contact = "seth1010@gmail.com";
SWEP.Purpose = "For Killing Zombies";
SWEP.Instructions = "Aim. Shoot.";
SWEP.PrintName = "Zombieafier";
SWEP.Slot = 3;
SWEP.SlotPos = 4;
SWEP.DrawCrosshair = true;
SWEP.DrawAmmo = true;
SWEP.ViewModel = "models/weapons/v_smg2.mdl";
SWEP.WorldModel = "models/weapons/w_pistol.mdl";
SWEP.ViewModelFOV = 64;
SWEP.ReloadSound = "weapons/pistol/pistol_reload1.wav";
SWEP.HoldType = "pistol";
SWEP.Spawnable = true;
SWEP.AdminSpawnable = true;
SWEP.Weight = 3;
SWEP.AutoSwitchTo = false;
SWEP.AutoSwitchFrom = true;
SWEP.FiresUnderwater = false;

SWEP.Primary.ClipSize = 8;
SWEP.Primary.DefaultClip = 4;
SWEP.Secondary.Recoil = 1;
SWEP.Secondary.Spread = 0.1;
SWEP.Secondary.Delay = 2.0;
SWEP.Secondary.TakeAmmo = 1;
SWEP.Secondary.Message = "/n";
SWEP.Secondary.Sound = "weapons/mortar/mortar_fire1.wav";
SWEP.Secondary.Automatic = false;

SWEP.Primary.Recoil = 1;
SWEP.Primary.Spread = 0.1;
SWEP.Primary.Delay = 2.0;
SWEP.Primary.TakeAmmo = 1;
SWEP.Primary.Message = "/n";
SWEP.Primary.Automatic = false;
SWEP.Primary.Sound = "weapons/underwater_explode3.wav";

function SWEP:throw_attack (model_file)
    local tr = self.Owner:GetEyeTrace();
    self.Weapon:EmitSound (self.Primary.Sound);
    self.BaseClass.ShootEffects (self);
    if (!SERVER) then return end;
    local ent = ents.Create ("prop_physics");
    ent:SetModel (model_file);
    ent:SetPos (self.Owner:EyePos() + (self.Owner:GetAimVector() * 18));
    ent:SetAngles (self.Owner:EyeAngles());
    ent:Spawn();
    local phys = ent:GetPhysicsObject();
    local shot_length = tr.HitPos:Length();
    phys:ApplyForceCenter (self.Owner:GetAimVector():GetNormalized() * math.pow (shot_length, 2));
    cleanup.Add (self.Owner, "props", ent);
    undo.Create ("Thrown model");
    undo.AddEntity (ent);
    undo.SetPlayer (self.Owner);
    undo.Finish();
end

function SWEP:Initialize()
    util.PrecacheSound(self.Primary.Sound)
     util.PrecacheSound(self.Secondary.Sound)
    if ( SERVER ) then
       self:SetWeaponHoldType( self.HoldType )
   end
end

function SWEP:PrimaryAttack()
   self:TakePrimaryAmmo(self.Primary.TakeAmmo)
   self:throw_attack ("models/grenade_4.mdl");
   self:Msg( self.Primary.Message );
   self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
   self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
end

function SWEP:SecondaryAttack()
   self:TakePrimaryAmmo(self.Secondary.TakeAmmo)
   self:throw_attack ("models/grenade_6.mdl");
   self:Msg( self.Secondary.Message );
   self.Weapon:SetNextPrimaryFire( CurTime() + self.Secondary.Delay )
   self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
end

function SWEP:Think()
end

function SWEP:Reload()
   self.Weapon:DefaultReload(ACT_VM_RELOAD)
   return true
end

function SWEP:Deploy()
   self.Weapon:SendWeaponAnim(ACT_VM_DRAW);
   GAMEMODE:SetPlayerSpeed(self.Owner,190,350);
   return true
end

function SWEP:Holster()
   return true
end

function SWEP:OnRemove()
end

function SWEP:OnRestore()
end

function SWEP:Precache()
end

function SWEP:OwnerChanged()
end
